home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 22 / AMUG_22-4.ISO / Files IV / Prog / T / TinyTools-2.sit / TinyTools / hqx.h < prev    next >
MacBinary  |  1997-10-07  |  4.6 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert Jesper Olsen Module (music/jesperOlsen) magic Supported
1% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Tue Oct 7 02:50:58 1997, modified Tue Oct 7 02:50:58 1997, creator 'MPS ', type ASCII, 4091 bytes "hqx.h" , at 0x107b 428 bytes resource default (weak)
99% file data default
49% TrID Macintosh plain text (MacBinary) default
33% TrID TTComp archive compressed (bin-2K) default (weak)
16% TrID MacBinary 2 default (weak)
0% TrID Sybase iAnywhere database files default (weak)
100% dearkID deark: macbinary default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 05 68 71 78 2e 68 00 | 00 00 00 00 00 00 00 00 |..hqx.h.|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 0f fb 00 | 00 01 ac b0 5f 8c 52 b0 |........|...._.R.|
|00000060| 5f 8c 52 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |_.R.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ec 6e 00 00 |........|.....n..|
|00000080| 0d 23 69 66 6e 64 65 66 | 20 5f 5f 48 51 58 5f 5f |.#ifndef| __HQX__|
|00000090| 0d 23 64 65 66 69 6e 65 | 20 5f 5f 48 51 58 5f 5f |.#define| __HQX__|
|000000a0| 0d 0d 2f 2a 20 66 69 6c | 65 20 68 71 78 2e 68 20 |../* fil|e hqx.h |
|000000b0| 0d 09 42 69 6e 48 65 78 | 20 64 65 63 6f 64 65 72 |..BinHex| decoder|
|000000c0| 2f 65 6e 63 6f 64 65 72 | 20 72 6f 75 74 69 6e 65 |/encoder| routine|
|000000d0| 73 2c 20 64 65 66 69 6e | 69 74 69 6f 6e 73 2e 0d |s, defin|itions..|
|000000e0| 09 43 6f 70 79 72 69 67 | 68 74 20 28 63 29 20 31 |.Copyrig|ht (c) 1|
|000000f0| 39 39 37 20 62 79 20 4a | 6f 68 6e 20 4d 6f 6e 74 |997 by J|ohn Mont|
|00000100| 62 72 69 61 6e 64 2e 20 | 20 41 6c 6c 20 52 69 67 |briand. | All Rig|
|00000110| 68 74 73 20 52 65 73 65 | 72 76 65 64 2e 0d 09 50 |hts Rese|rved...P|
|00000120| 65 72 6d 69 73 73 69 6f | 6e 20 67 72 61 6e 74 65 |ermissio|n grante|
|00000130| 64 20 66 6f 72 20 70 75 | 62 6c 69 63 20 75 73 65 |d for pu|blic use|
|00000140| 2e 0d 09 44 69 73 74 72 | 69 62 75 74 65 20 66 72 |...Distr|ibute fr|
|00000150| 65 65 6c 79 20 69 6e 20 | 61 72 65 61 73 20 77 68 |eely in |areas wh|
|00000160| 65 72 65 20 74 68 65 20 | 6c 61 77 73 20 6f 66 20 |ere the |laws of |
|00000170| 63 6f 70 79 72 69 67 68 | 74 20 61 70 70 6c 79 2e |copyrigh|t apply.|
|00000180| 0d 09 55 53 45 20 41 54 | 20 59 4f 55 52 20 4f 57 |..USE AT| YOUR OW|
|00000190| 4e 20 52 49 53 4b 2e 0d | 09 44 4f 20 4e 4f 54 20 |N RISK..|.DO NOT |
|000001a0| 44 49 53 54 52 49 42 55 | 54 45 20 4d 4f 44 49 46 |DISTRIBU|TE MODIF|
|000001b0| 49 45 44 20 43 4f 50 49 | 45 53 2e 0d 09 43 6f 6d |IED COPI|ES...Com|
|000001c0| 6d 65 6e 74 73 2f 71 75 | 65 73 74 69 6f 6e 73 2f |ments/qu|estions/|
|000001d0| 70 6f 73 74 63 61 72 64 | 73 20 74 6f 20 74 68 65 |postcard|s to the|
|000001e0| 20 61 75 74 68 6f 72 20 | 61 74 20 74 68 65 20 61 | author |at the a|
|000001f0| 64 64 72 65 73 73 3a 0d | 09 09 4a 6f 68 6e 20 4d |ddress:.|..John M|
|00000200| 6f 6e 74 62 72 69 61 6e | 64 0d 09 09 50 2e 4f 2e |ontbrian|d...P.O.|
|00000210| 20 42 6f 78 2e 20 31 31 | 33 33 0d 09 09 53 61 73 | Box. 11|33...Sas|
|00000220| 6b 61 74 6f 6f 6e 20 53 | 61 73 6b 61 74 63 68 65 |katoon S|askatche|
|00000230| 77 61 6e 20 43 61 6e 61 | 64 61 0d 09 09 53 37 4b |wan Cana|da...S7K|
|00000240| 20 33 4e 32 0d 09 6f 72 | 20 62 79 20 65 6d 61 69 | 3N2..or| by emai|
|00000250| 6c 20 61 74 3a 0d 09 09 | 74 69 6e 79 6a 6f 68 6e |l at:...|tinyjohn|
|00000260| 40 73 6b 2e 73 79 6d 70 | 61 74 69 63 6f 2e 63 61 |@sk.symp|atico.ca|
|00000270| 0d 09 49 66 20 79 6f 75 | 20 77 6f 75 6c 64 20 6c |..If you| would l|
|00000280| 69 6b 65 20 74 6f 20 68 | 61 76 65 3a 0d 09 09 74 |ike to h|ave:...t|
|00000290| 65 63 68 6e 69 63 61 6c | 20 73 75 70 70 6f 72 74 |echnical| support|
|000002a0| 20 72 65 67 61 72 64 69 | 6e 67 20 74 68 69 73 20 | regardi|ng this |
|000002b0| 66 69 6c 65 2c 20 73 65 | 6e 64 20 61 20 70 6f 73 |file, se|nd a pos|
|000002c0| 74 63 61 72 64 2e 0d 09 | 73 65 65 20 61 6c 73 6f |tcard...|see also|
|000002d0| 3a 0d 09 09 68 74 74 70 | 3a 2f 2f 77 77 77 33 2e |:...http|://www3.|
|000002e0| 73 6b 2e 73 79 6d 70 61 | 74 69 63 6f 2e 63 61 2f |sk.sympa|tico.ca/|
|000002f0| 74 69 6e 79 6a 6f 68 6e | 0d 2a 2f 0d 0d 2f 2a 20 |tinyjohn|.*/../* |
|00000300| 72 6f 75 74 69 6e 65 73 | 20 66 6f 72 20 65 6e 63 |routines| for enc|
|00000310| 6f 64 69 6e 67 20 6f 72 | 20 64 65 63 6f 64 69 6e |oding or| decodin|
|00000320| 67 20 62 69 6e 68 65 78 | 20 66 69 6c 65 73 2e 20 |g binhex| files. |
|00000330| 20 54 68 65 73 65 20 72 | 6f 75 74 69 6e 65 73 20 | These r|outines |
|00000340| 61 72 65 20 64 65 73 69 | 67 6e 65 64 0d 66 6f 72 |are desi|gned.for|
|00000350| 20 75 73 65 20 77 69 74 | 68 20 61 6e 79 20 64 61 | use wit|h any da|
|00000360| 74 61 20 73 6f 75 72 63 | 65 2f 73 69 6e 6b 2e 20 |ta sourc|e/sink. |
|00000370| 20 54 68 65 79 20 61 72 | 65 20 72 65 2d 65 6e 74 | They ar|e re-ent|
|00000380| 72 61 6e 74 20 73 6f 20 | 74 68 65 79 20 63 61 6e |rant so |they can|
|00000390| 20 62 65 20 75 73 65 64 | 0d 69 6e 20 73 65 76 65 | be used|.in seve|
|000003a0| 72 61 6c 20 74 68 72 65 | 61 64 73 20 73 69 6d 75 |ral thre|ads simu|
|000003b0| 6c 74 61 6e 65 6f 75 73 | 6c 79 2e 20 53 79 73 74 |ltaneous|ly. Syst|
|000003c0| 65 6d 20 36 20 6f 6e 20 | 75 70 2e 2e 2e 20 20 43 |em 6 on |up... C|
|000003d0| 61 6e 20 68 61 6e 64 6c | 65 20 61 6e 79 20 66 69 |an handl|e any fi|
|000003e0| 6c 65 0d 73 69 7a 65 2e | 20 20 55 73 65 73 20 61 |le.size.| Uses a|
|000003f0| 20 63 68 61 69 6e 65 64 | 20 72 65 61 64 2f 77 72 | chained| read/wr|
|00000400| 69 74 65 20 61 6c 67 6f | 72 69 74 68 6d 20 73 6f |ite algo|rithm so|
|00000410| 20 6d 65 6d 6f 72 79 20 | 72 65 71 75 69 72 65 6d | memory |requirem|
|00000420| 65 6e 74 73 20 61 72 65 | 20 6c 6f 77 2e 20 20 2a |ents are| low. *|
|00000430| 2f 0d 0d 23 69 6e 63 6c | 75 64 65 20 3c 54 79 70 |/..#incl|ude <Typ|
|00000440| 65 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |es.h>.#i|nclude <|
|00000450| 46 69 6c 65 73 2e 68 3e | 0d 0d 2f 2a 20 42 49 4e |Files.h>|../* BIN|
|00000460| 48 45 58 20 45 4e 43 4f | 44 45 52 20 2d 2d 20 65 |HEX ENCO|DER -- e|
|00000470| 6e 63 6f 64 65 20 61 20 | 6d 61 63 69 6e 74 6f 73 |ncode a |macintos|
|00000480| 68 20 66 69 6c 65 20 69 | 6e 20 62 69 6e 68 65 78 |h file i|n binhex|
|00000490| 20 66 6f 72 6d 61 74 20 | 2a 2f 0d 2f 2a 20 20 20 | format |*/./* |
|000004a0| 20 6f 75 74 70 75 74 20 | 69 73 20 73 65 6e 74 20 | output |is sent |
|000004b0| 74 6f 20 61 20 75 73 65 | 72 2d 64 65 66 69 6e 65 |to a use|r-define|
|000004c0| 64 20 6f 75 74 70 75 74 | 20 73 69 6e 6b 2e 20 2a |d output| sink. *|
|000004d0| 2f 0d 0d 2f 2a 20 48 51 | 58 53 69 6e 6b 20 64 65 |/../* HQ|XSink de|
|000004e0| 66 69 6e 65 73 20 61 20 | 66 75 6e 63 74 69 6f 6e |fines a |function|
|000004f0| 20 74 68 61 74 20 77 69 | 6c 6c 20 72 65 63 65 69 | that wi|ll recei|
|00000500| 76 65 20 64 61 74 61 20 | 70 72 6f 64 75 63 65 64 |ve data |produced|
|00000510| 20 62 79 0d 09 74 68 65 | 20 48 51 58 45 6e 63 6f | by..the| HQXEnco|
|00000520| 64 65 20 72 6f 75 74 69 | 6e 65 2e 20 20 72 65 66 |de routi|ne. ref|
|00000530| 63 6f 6e 20 69 73 20 61 | 76 61 69 6c 61 62 6c 65 |con is a|vailable|
|00000540| 20 66 6f 72 20 79 6f 75 | 72 20 61 70 70 6c 69 63 | for you|r applic|
|00000550| 61 74 69 6f 6e 27 73 0d | 09 75 73 65 20 61 6e 64 |ation's.|.use and|
|00000560| 20 69 73 20 74 68 65 20 | 73 61 6d 65 20 72 65 66 | is the |same ref|
|00000570| 63 6f 6e 20 76 61 6c 75 | 65 20 70 61 73 73 65 64 |con valu|e passed|
|00000580| 20 74 6f 20 48 51 58 45 | 6e 63 6f 64 65 2e 20 20 | to HQXE|ncode. |
|00000590| 72 65 74 75 72 6e 69 6e | 67 0d 09 61 6e 79 20 65 |returnin|g..any e|
|000005a0| 72 72 6f 72 20 63 6f 64 | 65 20 6f 74 68 65 72 20 |rror cod|e other |
|000005b0| 74 68 61 6e 20 6e 6f 45 | 72 72 20 77 69 6c 6c 20 |than noE|rr will |
|000005c0| 61 62 6f 72 74 20 48 51 | 58 45 6e 63 6f 64 65 2e |abort HQ|XEncode.|
|000005d0| 20 20 48 51 58 45 6e 63 | 6f 64 65 0d 09 69 6d 70 | HQXEnc|ode..imp|
|000005e0| 6c 65 6d 65 6e 74 73 20 | 61 20 62 75 66 66 65 72 |lements |a buffer|
|000005f0| 69 6e 67 20 73 63 68 65 | 6d 65 20 6f 66 20 69 74 |ing sche|me of it|
|00000600| 73 20 6f 77 6e 2c 20 73 | 6f 20 74 68 65 72 65 20 |s own, s|o there |
|00000610| 69 73 20 6e 6f 20 6e 65 | 65 64 20 66 6f 72 0d 09 |is no ne|ed for..|
|00000620| 79 6f 75 72 20 73 69 6e | 6b 20 66 75 6e 63 74 69 |your sin|k functi|
|00000630| 6f 6e 20 74 6f 20 62 65 | 20 63 6f 6e 63 65 72 6e |on to be| concern|
|00000640| 65 64 20 61 62 6f 75 74 | 20 62 75 66 66 65 72 69 |ed about| bufferi|
|00000650| 6e 67 20 64 61 74 61 2e | 20 2a 2f 0d 74 79 70 65 |ng data.| */.type|
|00000660| 64 65 66 20 4f 53 45 72 | 72 20 28 2a 48 51 58 53 |def OSEr|r (*HQXS|
|00000670| 69 6e 6b 29 28 76 6f 69 | 64 2a 20 62 75 66 66 65 |ink)(voi|d* buffe|
|00000680| 72 2c 20 6c 6f 6e 67 20 | 63 6f 75 6e 74 2c 20 6c |r, long |count, l|
|00000690| 6f 6e 67 20 72 65 66 63 | 6f 6e 29 3b 0d 0d 2f 2a |ong refc|on);../*|
|000006a0| 20 48 51 58 45 6e 63 6f | 64 65 20 72 65 61 64 73 | HQXEnco|de reads|
|000006b0| 20 74 68 65 20 69 6e 64 | 69 63 61 74 65 64 20 6d | the ind|icated m|
|000006c0| 61 63 69 6e 74 6f 73 68 | 20 66 69 6c 65 20 61 6e |acintosh| file an|
|000006d0| 64 20 6f 75 74 70 75 74 | 73 20 74 68 65 20 62 69 |d output|s the bi|
|000006e0| 6e 68 65 78 0d 09 65 71 | 75 69 76 61 6c 65 6e 74 |nhex..eq|uivalent|
|000006f0| 20 74 6f 20 74 68 65 20 | 73 69 6e 6b 2e 20 20 49 | to the |sink. I|
|00000700| 66 20 74 68 65 20 48 51 | 58 53 69 6e 6b 20 72 65 |f the HQ|XSink re|
|00000710| 74 75 72 6e 73 20 61 20 | 6e 6f 6e 2d 7a 65 72 6f |turns a |non-zero|
|00000720| 20 72 65 73 75 6c 74 20 | 63 6f 64 65 2c 0d 09 74 | result |code,..t|
|00000730| 68 65 6e 20 65 78 65 63 | 75 74 69 6f 6e 20 73 74 |hen exec|ution st|
|00000740| 6f 70 73 20 61 6e 64 20 | 48 51 58 45 6e 63 6f 64 |ops and |HQXEncod|
|00000750| 65 20 77 69 6c 6c 20 72 | 65 74 75 72 6e 20 74 68 |e will r|eturn th|
|00000760| 65 20 72 65 73 75 6c 74 | 2e 20 20 72 65 66 63 6f |e result|. refco|
|00000770| 6e 0d 09 69 73 20 61 20 | 76 61 6c 75 65 20 70 61 |n..is a |value pa|
|00000780| 73 73 65 64 20 74 6f 20 | 74 68 65 20 73 69 6e 6b |ssed to |the sink|
|00000790| 20 66 75 6e 63 74 69 6f | 6e 2e 20 20 2a 2f 0d 4f | functio|n. */.O|
|000007a0| 53 45 72 72 20 48 51 58 | 45 6e 63 6f 64 65 28 53 |SErr HQX|Encode(S|
|000007b0| 74 72 69 6e 67 50 74 72 | 20 6e 61 6d 65 2c 20 73 |tringPtr| name, s|
|000007c0| 68 6f 72 74 20 76 6f 6c | 2c 20 6c 6f 6e 67 20 64 |hort vol|, long d|
|000007d0| 69 72 2c 20 48 51 58 53 | 69 6e 6b 20 64 73 74 2c |ir, HQXS|ink dst,|
|000007e0| 20 6c 6f 6e 67 20 72 65 | 66 63 6f 6e 29 3b 0d 0d | long re|fcon);..|
|000007f0| 0d 0d 2f 2a 20 42 49 4e | 48 45 58 20 44 45 43 4f |../* BIN|HEX DECO|
|00000800| 44 45 52 20 2d 2d 20 64 | 65 63 6f 64 65 20 62 69 |DER -- d|ecode bi|
|00000810| 6e 68 65 78 20 69 6e 70 | 75 74 20 65 78 74 72 61 |nhex inp|ut extra|
|00000820| 63 74 65 64 20 66 72 6f | 6d 20 61 20 75 73 65 72 |cted fro|m a user|
|00000830| 20 2a 2f 0d 2f 2a 20 64 | 65 66 69 6e 65 64 20 69 | */./* d|efined i|
|00000840| 6e 70 75 74 20 73 6f 75 | 72 63 65 2e 20 20 20 4f |nput sou|rce. O|
|00000850| 6e 6c 79 20 42 69 6e 68 | 65 78 20 63 68 61 72 61 |nly Binh|ex chara|
|00000860| 63 74 65 72 73 20 64 65 | 6c 69 6d 69 74 65 64 20 |cters de|limited |
|00000870| 62 79 20 63 6f 6c 6f 6e | 73 20 2a 2f 0d 2f 2a 20 |by colon|s */./* |
|00000880| 61 72 65 20 63 6f 6e 76 | 65 72 74 65 64 20 61 6e |are conv|erted an|
|00000890| 64 20 6d 75 6c 74 69 70 | 6c 65 20 62 69 6e 68 65 |d multip|le binhe|
|000008a0| 78 20 64 61 74 61 20 73 | 65 63 74 69 6f 6e 73 20 |x data s|ections |
|000008b0| 61 72 65 20 61 6c 6c 6f | 77 65 64 2e 20 2a 2f 0d |are allo|wed. */.|
|000008c0| 2f 2a 20 46 6f 72 20 65 | 78 61 6d 70 6c 65 2c 20 |/* For e|xample, |
|000008d0| 20 74 68 65 20 64 61 74 | 61 3a 20 2a 2f 0d 2f 2a | the dat|a: */./*|
|000008e0| 20 20 20 20 20 20 20 3a | 22 40 4b 61 48 23 6a 53 | :|"@KaH#jS|
|000008f0| 21 3a 20 20 20 20 20 2e | 2e 2e 73 6f 6d 65 20 67 |!: .|..some g|
|00000900| 61 72 62 61 67 65 20 63 | 68 61 72 61 63 74 65 72 |arbage c|haracter|
|00000910| 73 2e 2e 2e 20 20 3a 26 | 34 26 40 26 34 30 3a 20 |s... :&|4&@&40: |
|00000920| 2a 2f 0d 2f 2a 20 69 73 | 20 70 72 6f 63 65 73 73 |*/./* is| process|
|00000930| 65 64 20 74 68 65 20 73 | 61 6d 65 20 61 73 20 74 |ed the s|ame as t|
|00000940| 68 65 20 62 69 6e 68 65 | 78 20 73 65 71 75 65 6e |he binhe|x sequen|
|00000950| 63 65 3a 2a 2f 0d 2f 2a | 20 20 20 20 20 20 20 3a |ce:*/./*| :|
|00000960| 22 40 4b 61 48 23 6a 53 | 21 26 34 26 40 26 34 30 |"@KaH#jS|!&4&@&40|
|00000970| 3a 09 2a 2f 0d 0d 0d 2f | 2a 20 48 51 58 53 6f 75 |:.*/.../|* HQXSou|
|00000980| 72 63 65 20 64 65 66 69 | 6e 65 73 20 61 20 66 75 |rce defi|nes a fu|
|00000990| 6e 63 74 69 6f 6e 20 70 | 72 6f 76 69 64 69 6e 67 |nction p|roviding|
|000009a0| 20 61 20 64 61 74 61 20 | 73 6f 75 72 63 65 20 66 | a data |source f|
|000009b0| 6f 72 20 74 68 65 20 48 | 51 58 44 65 63 6f 64 65 |or the H|QXDecode|
|000009c0| 0d 09 72 6f 75 74 69 6e | 65 2e 20 20 59 6f 75 72 |..routin|e. Your|
|000009d0| 20 66 75 6e 63 74 69 6f | 6e 20 73 68 6f 75 6c 64 | functio|n should|
|000009e0| 20 61 74 74 65 6d 70 74 | 20 74 6f 20 72 65 61 64 | attempt| to read|
|000009f0| 20 2a 63 6f 75 6e 74 20 | 62 79 74 65 73 20 74 6f | *count |bytes to|
|00000a00| 20 74 68 65 0d 09 62 75 | 66 66 65 72 2e 20 20 42 | the..bu|ffer. B|
|00000a10| 65 66 6f 72 65 20 72 65 | 74 75 72 6e 69 6e 67 2c |efore re|turning,|
|00000a20| 20 79 6f 75 72 20 66 75 | 6e 63 74 69 6f 6e 20 73 | your fu|nction s|
|00000a30| 68 6f 75 6c 64 20 73 65 | 74 20 2a 63 6f 75 6e 74 |hould se|t *count|
|00000a40| 20 74 6f 20 74 68 65 0d | 09 61 63 74 75 61 6c 20 | to the.|.actual |
|00000a50| 6e 75 6d 62 65 72 20 6f | 66 20 62 79 74 65 73 20 |number o|f bytes |
|00000a60| 72 65 61 64 20 69 6e 74 | 6f 20 74 68 65 20 62 75 |read int|o the bu|
|00000a70| 66 66 65 72 2e 20 20 49 | 66 20 63 6f 75 6e 74 20 |ffer. I|f count |
|00000a80| 69 73 20 7a 65 72 6f 2c | 20 6f 72 20 74 68 65 0d |is zero,| or the.|
|00000a90| 09 73 6f 75 72 63 65 20 | 66 75 6e 63 74 69 6f 6e |.source |function|
|00000aa0| 20 72 65 74 75 72 6e 73 | 20 73 6f 6d 65 20 72 65 | returns| some re|
|00000ab0| 73 75 6c 74 20 6f 74 68 | 65 72 20 74 68 61 6e 20 |sult oth|er than |
|00000ac0| 65 6f 66 45 72 72 2c 20 | 48 51 58 44 65 63 6f 64 |eofErr, |HQXDecod|
|00000ad0| 65 0d 09 61 62 6f 72 74 | 73 20 70 72 6f 63 65 73 |e..abort|s proces|
|00000ae0| 73 69 6e 67 2e 20 20 48 | 51 58 44 65 63 6f 64 65 |sing. H|QXDecode|
|00000af0| 20 69 6d 70 6c 65 6d 65 | 6e 74 73 20 69 74 73 20 | impleme|nts its |
|00000b00| 6f 77 6e 20 62 75 66 66 | 65 72 69 6e 67 20 73 63 |own buff|ering sc|
|00000b10| 68 65 6d 65 0d 09 73 6f | 20 79 6f 75 72 20 73 6f |heme..so| your so|
|00000b20| 75 72 63 65 20 66 75 6e | 63 74 69 6f 6e 20 6e 65 |urce fun|ction ne|
|00000b30| 65 64 20 6e 6f 74 20 62 | 65 20 63 6f 6e 63 65 72 |ed not b|e concer|
|00000b40| 6e 65 64 20 61 62 6f 75 | 74 20 62 75 66 66 65 72 |ned abou|t buffer|
|00000b50| 69 6e 67 2e 20 20 2a 2f | 0d 74 79 70 65 64 65 66 |ing. */|.typedef|
|00000b60| 20 4f 53 45 72 72 20 28 | 2a 48 51 58 53 6f 75 72 | OSErr (|*HQXSour|
|00000b70| 63 65 29 28 76 6f 69 64 | 2a 20 62 75 66 66 65 72 |ce)(void|* buffer|
|00000b80| 2c 20 6c 6f 6e 67 20 2a | 63 6f 75 6e 74 2c 20 6c |, long *|count, l|
|00000b90| 6f 6e 67 20 72 65 66 63 | 6f 6e 29 3b 0d 0d 2f 2a |ong refc|on);../*|
|00000ba0| 20 48 51 58 4e 61 6d 65 | 46 69 6c 74 65 72 20 69 | HQXName|Filter i|
|00000bb0| 73 20 61 6e 20 6f 70 74 | 69 6f 6e 61 6c 20 72 6f |s an opt|ional ro|
|00000bc0| 75 74 69 6e 65 20 61 6c | 6c 6f 77 69 6e 67 20 79 |utine al|lowing y|
|00000bd0| 6f 75 72 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |our appl|ication |
|00000be0| 6f 70 6f 72 74 75 6e 69 | 74 79 0d 09 74 6f 20 6d |oportuni|ty..to m|
|00000bf0| 6f 64 69 66 79 20 74 68 | 65 20 66 69 6c 65 20 6e |odify th|e file n|
|00000c00| 61 6d 65 20 61 6e 64 20 | 6c 6f 63 61 74 69 6f 6e |ame and |location|
|00000c10| 20 6f 66 20 74 68 65 20 | 6d 61 63 69 6e 74 6f 73 | of the |macintos|
|00000c20| 68 20 66 69 6c 65 20 62 | 65 69 6e 67 20 64 65 63 |h file b|eing dec|
|00000c30| 6f 64 65 64 2e 0d 09 49 | 66 20 79 6f 75 72 20 66 |oded...I|f your f|
|00000c40| 69 6c 74 65 72 20 66 75 | 6e 63 74 69 6f 6e 20 72 |ilter fu|nction r|
|00000c50| 65 74 75 72 6e 73 20 61 | 20 6e 6f 6e 2d 7a 65 72 |eturns a| non-zer|
|00000c60| 6f 20 72 65 73 75 6c 74 | 20 63 6f 64 65 2c 20 48 |o result| code, H|
|00000c70| 51 58 44 65 63 6f 64 65 | 20 73 74 6f 70 73 0d 09 |QXDecode| stops..|
|00000c80| 70 72 6f 63 65 73 73 69 | 6e 67 20 64 61 74 61 20 |processi|ng data |
|00000c90| 66 72 6f 6d 20 74 68 65 | 20 73 6f 75 72 63 65 20 |from the| source |
|00000ca0| 61 6e 64 20 72 65 74 75 | 72 6e 73 20 74 68 65 20 |and retu|rns the |
|00000cb0| 72 65 73 75 6c 74 20 63 | 6f 64 65 2e 20 20 77 68 |result c|ode. wh|
|00000cc0| 65 6e 0d 09 48 51 58 4e | 61 6d 65 46 69 6c 74 65 |en..HQXN|ameFilte|
|00000cd0| 72 20 69 73 20 63 61 6c | 6c 65 64 2c 20 6e 61 6d |r is cal|led, nam|
|00000ce0| 65 20 69 73 20 74 68 65 | 20 6e 61 6d 65 20 6f 66 |e is the| name of|
|00000cf0| 20 74 68 65 20 66 69 6c | 65 20 61 6e 64 20 2a 76 | the fil|e and *v|
|00000d00| 6f 6c 20 61 6e 64 0d 09 | 2a 64 69 72 20 77 69 6c |ol and..|*dir wil|
|00000d10| 6c 20 62 65 20 7a 65 72 | 6f 2e 20 20 59 6f 75 72 |l be zer|o. Your|
|00000d20| 20 72 6f 75 74 69 6e 65 | 20 63 61 6e 20 6d 6f 64 | routine| can mod|
|00000d30| 69 66 79 20 61 6e 79 20 | 6f 72 20 61 6c 6c 20 6f |ify any |or all o|
|00000d40| 66 20 74 68 65 73 65 20 | 70 61 72 61 6d 65 74 65 |f these |paramete|
|00000d50| 72 73 0d 09 74 6f 20 73 | 70 65 63 69 66 79 20 61 |rs..to s|pecify a|
|00000d60| 20 64 69 66 66 65 72 65 | 6e 74 20 6f 75 74 70 75 | differe|nt outpu|
|00000d70| 74 20 66 69 6c 65 2e 20 | 20 2a 2f 0d 74 79 70 65 |t file. | */.type|
|00000d80| 64 65 66 20 4f 53 45 72 | 72 20 28 2a 48 51 58 4e |def OSEr|r (*HQXN|
|00000d90| 61 6d 65 46 69 6c 74 65 | 72 29 28 53 74 72 69 6e |ameFilte|r)(Strin|
|00000da0| 67 50 74 72 20 6e 61 6d | 65 2c 20 73 68 6f 72 74 |gPtr nam|e, short|
|00000db0| 20 2a 76 6f 6c 2c 20 6c | 6f 6e 67 20 2a 64 69 72 | *vol, l|ong *dir|
|00000dc0| 2c 20 6c 6f 6e 67 20 72 | 65 66 63 6f 6e 29 3b 0d |, long r|efcon);.|
|00000dd0| 0d 2f 2a 20 48 51 58 44 | 65 63 6f 64 65 20 64 65 |./* HQXD|ecode de|
|00000de0| 63 6f 64 65 73 20 61 20 | 62 69 6e 68 65 78 20 66 |codes a |binhex f|
|00000df0| 69 6c 65 20 75 73 69 6e | 67 20 64 61 74 61 20 66 |ile usin|g data f|
|00000e00| 72 6f 6d 20 74 68 65 20 | 73 6f 75 72 63 65 20 66 |rom the |source f|
|00000e10| 75 6e 63 74 69 6f 6e 2e | 0d 09 66 6e 61 6d 65 2c |unction.|..fname,|
|00000e20| 20 69 66 20 6e 6f 74 20 | 4e 55 4c 4c 2c 20 69 73 | if not |NULL, is|
|00000e30| 20 63 61 6c 6c 65 64 20 | 6f 6e 63 65 20 74 68 65 | called |once the|
|00000e40| 20 66 69 6c 65 20 6e 61 | 6d 65 20 68 61 73 20 62 | file na|me has b|
|00000e50| 65 65 6e 20 65 78 74 72 | 61 63 74 65 64 20 66 72 |een extr|acted fr|
|00000e60| 6f 6d 0d 09 74 68 65 20 | 62 69 6e 68 65 78 20 64 |om..the |binhex d|
|00000e70| 61 74 61 20 73 6f 20 79 | 6f 75 20 63 61 6e 20 63 |ata so y|ou can c|
|00000e80| 68 61 6e 67 65 20 77 68 | 65 72 65 20 74 68 65 20 |hange wh|ere the |
|00000e90| 66 69 6c 65 20 69 73 20 | 73 61 76 65 64 2e 20 20 |file is |saved. |
|00000ea0| 69 66 20 63 61 6e 5f 72 | 65 70 6c 61 63 65 0d 09 |if can_r|eplace..|
|00000eb0| 69 73 20 74 72 75 65 20 | 74 68 65 6e 20 64 65 63 |is true |then dec|
|00000ec0| 6f 64 65 64 20 66 69 6c | 65 73 20 77 69 6c 6c 20 |oded fil|es will |
|00000ed0| 72 65 70 6c 61 63 65 20 | 66 69 6c 65 73 20 77 69 |replace |files wi|
|00000ee0| 74 68 20 74 68 65 20 73 | 61 6d 65 20 6e 61 6d 65 |th the s|ame name|
|00000ef0| 2e 20 20 72 65 66 63 6f | 6e 0d 09 69 73 20 61 6e |. refco|n..is an|
|00000f00| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 2d 73 70 65 | applica|tion-spe|
|00000f10| 63 69 66 69 63 20 70 61 | 72 61 6d 65 74 65 72 20 |cific pa|rameter |
|00000f20| 70 61 73 73 65 64 20 74 | 6f 20 62 6f 74 68 20 74 |passed t|o both t|
|00000f30| 68 65 20 6e 61 6d 65 20 | 66 69 6c 74 65 72 20 66 |he name |filter f|
|00000f40| 75 6e 63 74 69 6f 6e 0d | 09 61 6e 64 20 74 68 65 |unction.|.and the|
|00000f50| 20 73 6f 75 72 63 65 20 | 66 75 6e 63 74 69 6f 6e | source |function|
|00000f60| 2e 20 20 69 66 20 68 65 | 61 64 65 72 5f 73 65 61 |. if he|ader_sea|
|00000f70| 72 63 68 20 69 73 20 74 | 72 75 65 2c 20 74 68 65 |rch is t|rue, the|
|00000f80| 20 72 6f 75 74 69 6e 65 | 20 64 6f 65 73 20 61 0d | routine| does a.|
|00000f90| 09 73 65 61 72 63 68 20 | 66 6f 72 20 74 68 65 20 |.search |for the |
|00000fa0| 73 74 72 69 6e 67 20 22 | 28 54 68 69 73 20 66 69 |string "|(This fi|
|00000fb0| 6c 65 20 6d 75 73 74 20 | 62 65 20 63 6f 6e 76 65 |le must |be conve|
|00000fc0| 72 74 65 64 20 77 69 74 | 68 20 42 69 6e 48 65 78 |rted wit|h BinHex|
|00000fd0| 20 34 2e 30 29 22 0d 09 | 62 65 66 6f 72 65 20 62 | 4.0)"..|before b|
|00000fe0| 65 67 69 6e 6e 69 6e 67 | 20 64 65 63 6f 64 69 6e |eginning| decodin|
|00000ff0| 67 20 62 69 6e 68 65 78 | 20 64 61 74 61 2e 20 20 |g binhex| data. |
|00001000| 2a 2f 0d 4f 53 45 72 72 | 20 48 51 58 44 65 63 6f |*/.OSErr| HQXDeco|
|00001010| 64 65 28 48 51 58 53 6f | 75 72 63 65 20 73 72 63 |de(HQXSo|urce src|
|00001020| 2c 20 48 51 58 4e 61 6d | 65 46 69 6c 74 65 72 20 |, HQXNam|eFilter |
|00001030| 66 6e 61 6d 65 2c 20 42 | 6f 6f 6c 65 61 6e 20 63 |fname, B|oolean c|
|00001040| 61 6e 5f 72 65 70 6c 61 | 63 65 2c 20 0d 09 42 6f |an_repla|ce, ..Bo|
|00001050| 6f 6c 65 61 6e 20 68 65 | 61 64 65 72 5f 73 65 61 |olean he|ader_sea|
|00001060| 72 63 68 2c 20 6c 6f 6e | 67 20 72 65 66 63 6f 6e |rch, lon|g refcon|
|00001070| 29 3b 0d 0d 23 65 6e 64 | 69 66 0d 00 00 00 00 00 |);..#end|if......|
|00001080| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00001090| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 53 74 |.h>.#inc|lude <St|
|000010a0| 64 49 4f 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |dIO.h>.#|include |
|000010b0| 05 68 71 78 2e 68 02 00 | 00 00 54 45 58 54 4d 50 |.hqx.h..|..TEXTMP|
|000010c0| 53 20 01 00 ff ff ff ff | 00 00 00 00 39 e2 00 00 |S ......|....9...|
|000010d0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 ff ff ff ff |..TEXTMP|S ......|
|000010e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010f0| 00 00 ab e6 ef e1 00 00 | 0f fb 00 00 01 ac 64 65 |........|......de|
|00001100| 20 3c 53 74 64 41 72 67 | 2e 68 3e 0d 23 69 6e 63 | <StdArg|.h>.#inc|
|00001110| 6c 75 64 65 20 3c 43 75 | 72 73 6f 72 43 74 6c 2e |lude <Cu|rsorCtl.|
|00001120| 68 3e 0d 0d 23 64 65 66 | 69 6e 65 20 6b 42 69 6e |h>..#def|ine kBin|
|00001130| 48 65 78 43 72 65 61 74 | 6f 72 20 27 42 6e 48 51 |HexCreat|or 'BnHQ|
|00001140| 27 0d 0d 75 6e 73 69 67 | 6e 65 64 20 73 68 6f 72 |'..unsig|ned shor|
|00001150| 74 20 43 61 6c 63 43 52 | 43 28 75 6e 73 69 67 6e |t CalcCR|C(unsign|
|00001160| 65 64 20 73 68 6f 72 74 | 20 63 72 63 2c 20 75 6e |ed short| crc, un|
|00001170| 73 69 67 6e 65 64 20 63 | 68 61 72 20 63 68 29 20 |signed c|har ch) |
|00001180| 00 00 00 48 00 09 47 65 | 6e 65 76 61 00 00 28 63 |...H..Ge|neva..(c|
|00001190| 03 df 96 90 39 35 20 62 | 79 20 4a 6f 68 6e 20 4d |....95 b|y John M|
|000011a0| 6f 6e 74 62 72 69 00 03 | 00 08 00 43 00 9a 02 4f |ontbri..|...C...O|
|000011b0| 02 6f 00 43 00 9a 02 4f | 02 6f b0 5f 54 12 00 00 |.o.C...O|.o._T...|
|000011c0| 02 79 00 00 02 79 00 00 | 00 00 01 00 00 00 00 1e |.y...y..|........|
|000011d0| 00 43 00 9a 02 4f 02 6f | 00 43 00 9a 02 4f 02 6f |.C...O.o|.C...O.o|
|000011e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000011f0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 03 d6 |.....n..|.n...>..|
|00001200| 71 38 26 32 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |q8&2....|.>..MPSR|
|00001210| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00001220| 03 f0 ff ff 00 00 00 4c | 03 d7 cc 18 00 00 00 00 |.......L|........|
|00001230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001260| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001270| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+